'''
循环
'''
# for循环：

nums = [1, 5, 6, 9, 7, 3]
target = 6
num = []
for i in nums:
    # for j in nums:
    # if i + j == target:
    #     num.append(i)
    #     num.append(j)
    #     x = nums.index(i)
    #     y = nums.index(j)
    #     break
    if i == target:
        num.append(i)
        x = nums.index(i)
        break
print(num, x)

# range函数
# 练习1
numbers = []
count = 0
for i in range(101):
    if i % 3 == 0:
        count += 1
        numbers.append(i)
print(numbers)
print('总共', count, '个')

print('-----------------------------------------')
# 练习2：统计1-100中能被4整除并且个位数是2的数字的个数
c = 0
for i in range(1, 101):
    if i % 4 == 0 and i % 10 == 2:
        print(i)
        c += 1
print('个数：', c)
print('------------------------')
# 计算1+2+3+4+5..+100
sum1 = 0
for i in range(1,11):
    sum1 += i
print(sum1)

